//package de.traveltainment.concept.envers.audit.listener;
//
//import de.traveltainment.concept.envers.audit.lifecycle.Journal;
//import de.traveltainment.concept.envers.audit.lifecycle.Lifecycle;
//import de.traveltainment.concept.envers.audit.lifecycle.Stage;
//import de.traveltainment.concept.envers.entities.Vito;
//import de.traveltainment.concept.envers.repository.JournalRepository;
//import de.traveltainment.concept.envers.repository.LifecycleRepositoy;
//import org.hibernate.envers.AuditReader;
//import org.hibernate.envers.AuditReaderFactory;
//
//import javax.inject.Inject;
//import javax.inject.Singleton;
//import javax.persistence.EntityManager;
//import javax.persistence.PersistenceException;
//
///**
// * Created by borlis on 17.06.2014.
// */
//
//@Singleton
//public class DPCTRevisionHandler {
//    @Inject
//    private LifecycleRepositoy lifecycleRepository;
//
//    @Inject
//    private EntityManager em;
//
//
//    public Lifecycle newRevision(Journal journal) throws Exception {
////        Lifecycle lifecycle = null;
////        try {
////            lifecycle = lifecycleRepository.merge(Stage.working_copy);
////            journal.setLifecycle(lifecycle);
////            AuditReader reader = AuditReaderFactory.get(em);
////            Vito vito = reader.getCurrentRevision(Vito.class, false);
////            journal.setEntityId(vito.getId());
////            journal.setEntityName("vito");
////            journalRepository.create(journal);
////            return lifecycle;
////        } catch (PersistenceException error) {
////            error.printStackTrace();
////            throw new Exception(error);
////        }
//        return null;
//    }
//
//}
